package io.gitee.luoyuan800.tool.llm.agent;

import io.gitee.luoyuan800.tool.llm.bean.config.AiAgentConfig;
import io.gitee.luoyuan800.tool.llm.bean.request.ChatRequest;
import io.gitee.luoyuan800.tool.llm.bean.request.HunYuanChatRequest;
import io.gitee.luoyuan800.tool.llm.web.RestfulClient;

/**
 * 腾讯混元大模型接口调用，基本和OpenAI的一直，只是添加多几个特殊的参数。
 */
public class HunYuanAgent extends CommonAgent {
    public HunYuanAgent(AiAgentConfig aiAgentConfig, RestfulClient restTemplate, String name, String model) {
        super(aiAgentConfig, restTemplate, name, model);
    }

    @Override
    ChatRequest buildRequest(int resultCount) {
        HunYuanChatRequest request = new HunYuanChatRequest();
        setRequestParams(resultCount, request);
        return request;
    }

    @Override
    void setRequestParams(int resultCount, ChatRequest request) {
        super.setRequestParams(resultCount, request);
        HunYuanChatRequest hunyuanRequest  = (HunYuanChatRequest) request;
        hunyuanRequest.setCitation(getAiAgentConfig().isWebSearchCitation());
        hunyuanRequest.setEnableEnhancement(getAiAgentConfig().isWebSearch());
        hunyuanRequest.setSearchInfo(getAiAgentConfig().isWebSearchTrace());
        hunyuanRequest.setEnableMultimedia(getAiAgentConfig().isEnableMultimedia());
        hunyuanRequest.setForceSearchEnhancement(getAiAgentConfig().isWebSearch());
        hunyuanRequest.setEnableDeepSearch(getAiAgentConfig().isEnableThink());
        hunyuanRequest.setEnableRecommendedQuestions(getAiAgentConfig().isEnableRecommendedQuestions());
    }
}
